package com.snowj.apaas.web;

import com.snowj.apaas.domain.auto.UserGroups;
import com.snowj.apaas.service.UserGroupsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(value = "用户组管理", tags = {"用户组操作接口"})
@RestController
@RequestMapping("/api")
public class UserGroupsController {

    private final UserGroupsService userGroupsService;

    public UserGroupsController(UserGroupsService userGroupsService) {
        this.userGroupsService = userGroupsService;
    }

    /**
     * 列出用户组列表
     *
     * @return
     */
    @ApiOperation("列出用户组列表")
    @GetMapping("/user-groups")
    public ResponseEntity<List<UserGroups>> listUserGroups() {
        List<UserGroups> userGroupsList = userGroupsService.listUserGroups();
        return ResponseEntity.ok(userGroupsList);
    }
}
